<script setup>
import UserInfo from "@/components/UserInfo/UserInfo.vue";
import {followApi} from "@/apis/followApi.js";
import {onMounted} from "vue";

const fan = ref(null);

const fetchFan = async () => {
  const res = await followApi.fetchFan(params.userid)
  console.log('粉丝',res)
  fan.value = res.data;
}

onMounted( () => {
  fetchFan();
})
</script>

<template>
<div class="title">粉丝</div>
<div class="space_fan">
  <UserInfo v-for="(fan, idx) in fan"
            class="user_container"
            :key="idx"
            :username="`${fan.userid}`"
            :userId="fan.userid"
  ></UserInfo>
</div>
</template>

<style scoped lang="less">
.title {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 16px;
  height: 34px;
  font-size: 24px;
  font-weight: 600;
  color: black;
}

.space_fan {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin-bottom: 20px;

  .user_container {
    width: calc(25% - 30px);
  }
}

</style>